#include "StaticJavaLib.h"
#include "gc.h"

struct EmptyTest{
};

struct EmptyTempTest{
  int i;
};

struct ManyTypesTest{
  int i;
  bool b;
  struct EmptyTest* e;
  struct EmptyTempTest* et;
  int* i_array;
  bool* b_array;
  struct EmptyTest** e_array;
};

struct SyntaxTest{
  int aa;
  bool bb;
  struct EmptyTest* cc;
  int* dd;
  bool* ee;
  struct EmptyTest** ff;
  int g;
};

int SyntaxTest_returnInt(){
  int i;
  int j;
  j = SyntaxTest_returnIntTemp2();
  i = 0;
  return i;
}

int SyntaxTest_returnIntTemp1(){
  int j;
  struct ManyTypesTest* f;
  gc_add_root_node(&f);
  f = (struct ManyTypesTest*)gc_malloc(sizeof(struct ManyTypesTest));
  f->i = 1;
  gc_free_root_node(&f);
  return f->i;
}

int SyntaxTest_returnIntTemp2(){
  int j;
  struct ManyTypesTest* f;
  gc_add_root_node(&f);
  f = (struct ManyTypesTest*)gc_malloc(sizeof(struct ManyTypesTest));
  f->et = (struct EmptyTempTest*)gc_malloc(sizeof(struct EmptyTempTest));
  f->et->i = 1;
  gc_free_root_node(&f);
  return f->et->i;
}

bool SyntaxTest_returnBoolean(bool b){
  bool c;
  int i;
  c = true;
  i = 0;
  return !!((!c) && (false || true) || (i > 2 && i >= -1) || 3 == i && (+4 != i) || 3 < 5 && ~1 <= -+~2);
}

struct EmptyTest* SyntaxTest_returnEmptyTest(int i,struct EmptyTest* e){
  int j;
  struct EmptyTest* ef;
  gc_add_root_node(&ef);
  struct ManyTypesTest* f;
  gc_add_root_node(&f);
  ef = (struct EmptyTest*)gc_malloc(sizeof(struct EmptyTest));
  f = (struct ManyTypesTest*)gc_malloc(sizeof(struct ManyTypesTest));
  f->e = (struct EmptyTest*)gc_malloc(sizeof(struct EmptyTest));
  j = SyntaxTest_returnIntTemp1();
  gc_free_root_node(&ef);
  gc_free_root_node(&f);
  return ef;
}

struct EmptyTest* SyntaxTest_returnEmptyTestTemp1(){
  struct ManyTypesTest* f;
  gc_add_root_node(&f);
  f = (struct ManyTypesTest*)gc_malloc(sizeof(struct ManyTypesTest));
  f->e = (struct EmptyTest*)gc_malloc(sizeof(struct EmptyTest));
  gc_free_root_node(&f);
  return f->e;
}

int* SyntaxTest_returnIntArray(){
  int* i;
  gc_add_root_node(&i);
  i = (int*)gc_malloc(sizeof(int)*((((unsigned)(1 + ((2 - 3) * 4) / (5 % 6 << 7) >> (8))) >> 9) + 3));
  gc_free_root_node(&i);
  return i;
}

bool* SyntaxTest_returnBooleanArray(bool* b){
  bool* c;
  gc_add_root_node(&c);
  c = (bool*)gc_malloc(sizeof(bool)*3);
  *(c+0) = true;
  *(c+1) = false;
  *(c+2) = false;
  gc_free_root_node(&c);
  return (c);
}

struct EmptyTest** SyntaxTest_returnObjectArray(int* i,struct EmptyTest** e){
  return e;
}

void SyntaxTest_returnVoid(){
}

void main(int argc,char** argv){
  int i;
  int* i_array;
  gc_add_root_node(&i_array);
  int j;
  bool b;
  bool* b_array;
  gc_add_root_node(&b_array);
  struct EmptyTest* et1;
  gc_add_root_node(&et1);
  struct EmptyTest* et2;
  gc_add_root_node(&et2);
  struct ManyTypesTest* m;
  gc_add_root_node(&m);
  struct ManyTypesTest** m_array;
  gc_add_root_node(&m_array);
  i = 0;
  j = i;
  b = true;
  if((i <= 0)){
    while(~9 <= i && i == -1){
      i = i + i;
    }
    b = false;
    while(true && b){
      i++;
    }
    i--;
    for(i = 0;!(i != 0);i--,i++,i--){
      i = ((unsigned)(i)) >> +-1;
    }
  }
  do{
     i++;
  }while(+7 << ~(-5) == j);
  m = (struct ManyTypesTest*)gc_malloc(sizeof(struct ManyTypesTest));
  m->b = false;
  i = 4;
  m_array = (struct ManyTypesTest**)gc_malloc(sizeof(struct ManyTypesTest*)*i);
  m_array[0] = m;
  i_array = (int*)gc_malloc(sizeof(int)*4);
  *(i_array+0) = 0;
  *(i_array+1) = i;
  *(i_array+2) = j;
  *(i_array+3) = 7;
  StaticJavaLib_printi(i_array[0]);
  StaticJavaLib_printlnn();
  StaticJavaLib_printlni(i_array[0]);
  StaticJavaLib_printi(i_array[1]);
  StaticJavaLib_printlnn();
  StaticJavaLib_printlni(i_array[1]);
  StaticJavaLib_printi(i_array[2]);
  StaticJavaLib_printlnn();
  StaticJavaLib_printlni(i_array[2]);
  StaticJavaLib_printi(i_array[3]);
  StaticJavaLib_printlnn();
  StaticJavaLib_printlni(i_array[3]);
  j = 0;
  m->i = 0;
  m_array[i_array[m->i]] = m_array[j];
  for(i = 2,i = j;j < (+i << 4) && j == i;j++,i--){
  }
  b = false;
  m = b?NULL:((m));
  b_array = (bool*)gc_malloc(sizeof(bool)*1);
  *(b_array+0) = true;
  StaticJavaLib_printb(b_array[0]);
  StaticJavaLib_printlnn();
  StaticJavaLib_printlnb(b_array[0]);
  m->b_array = b_array;
  et1 = (struct EmptyTest*)gc_malloc(sizeof(struct EmptyTest));
  et2 = SyntaxTest_returnEmptyTest(0,et1);
  b_array = SyntaxTest_returnBooleanArray(m->b_array);
  StaticJavaLib_printb(b_array[0]);
  StaticJavaLib_printlnn();
  StaticJavaLib_printlnb(b_array[0]);
  StaticJavaLib_printb(b_array[1]);
  StaticJavaLib_printlnn();
  StaticJavaLib_printlnb(b_array[1]);
  StaticJavaLib_printb(b_array[2]);
  StaticJavaLib_printlnn();
  StaticJavaLib_printlnb(b_array[2]);
  StaticJavaLib_printlnb(b_array[3]);
  m = NULL;
  b_array = (bool*)gc_malloc(sizeof(bool)*1);
  *(b_array+0) = true;
  StaticJavaLib_printb(b_array[0]);
  StaticJavaLib_printlnn();
  StaticJavaLib_printlnb(b_array[0]);
  i_array[SyntaxTest_returnInt()] = i_array[SyntaxTest_returnIntArray()[2]];
  gc_free_root_node(&i_array);
  gc_free_root_node(&b_array);
  gc_free_root_node(&et1);
  gc_free_root_node(&et2);
  gc_free_root_node(&m);
  gc_free_root_node(&m_array);
  gc_recycle();
}
